﻿using System;
using Identity.Dto;

namespace Coder.Workflow.ViewModel
{
    public class WorkActivityViewData<T>
        where T : ProcessInstanceViewData
    {
        public WorkActivityViewData(WorkActivity workActivity)
        {
            if (workActivity == null) throw new ArgumentNullException(nameof(workActivity));
            Id = workActivity.Id;
            // Name = workActivity.Name;


            if (workActivity.Role != null)
                Role = new RoleDto(workActivity.Role);

            Status = workActivity.Status;

            DepositTime = workActivity.DepositTime;
            CreateTime = workActivity.CreateTime;
            AssignTime = workActivity.AssignTime;
            Comment = workActivity.Comment;

            WorkTask = new WorkTaskViewData(workActivity.WorkTask);
        }

        //   public string Name { get; set; }
        public int Id { get; set; }
        public T ProcessInstance { get; set; }

        public RoleDto Role { get; set; }
        public WorkTaskViewData WorkTask { get; set; }

        public WorkActivityStatus Status { get; protected set; }

        // public User DepositUser { get; set; }
        public DateTimeOffset? DepositTime { get; set; }

        public DateTimeOffset CreateTime { get; protected set; }

        /// <summary>
        /// </summary>
        public DateTimeOffset? AssignTime { get; set; }

        public string Comment { get; set; }
    }
}